package com.gonsin.gview.model.form;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.gonsin.gview.model.GFormItemModel;
import com.gonsin.i18n.logic.T;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@ApiModel("隐藏框")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GHiddenModel extends GFormItemModel {

    @ApiModelProperty("text_input表示文本框，还有check_box\\file\\radio\\rich_text\\text_input\\tree_check_box\\tree_selector")
    private String itemType = "hidden";

    @ApiModelProperty("查询或者提交表单时，表示  ${keyName}=value")
    private String keyName;

    @ApiModelProperty("查询或者提交表单时，表示  ${keyName}=value")
    private String valueName;

    @Override
    public GFormItemModel tClone() {
        GHiddenModel model = new GHiddenModel();
        BeanUtil.copyProperties(this, model, CopyOptions.create().setIgnoreNullValue(true));
//        model.setName(T.t(name));
//        model.setPlaceholder(T.t(placeholder));
        return model;
    }
}
